package service;

import DAO.EmpManagerDao;
import DAO.EmpManagerImpl;
import entity.EmpManager;
import utils.Dbutils;

/**
 * @author lishunlin110
 * @version 1.0
 * @description: 管理员业务层实现
 * @date 2021/8/26 10:56
 */
public class EmpManagerServiceImpl implements EmpManagerService{
    @Override
    public EmpManager login(String username, String password) {
        EmpManagerDao empManagerDao = new EmpManagerImpl();
        EmpManager empManager =null;
        try {
            Dbutils.begin();
            EmpManager temp= empManagerDao.query(username);
            if(temp!=null){
                if(temp.getUsername().equals(username)){
                    empManager = temp;
                }
            }
            Dbutils.commit();
        } catch (Exception e) {
            Dbutils.rollback();
            e.printStackTrace();
        }
        return empManager;
    }
}
